package com.smartguard.dao;

import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.DBObject;
import com.smartguard.bean.User;
import com.smartguard.datasource.MongoConnection;
import com.smartguard.util.PojoUtil;

public class UserDAO {
	
	public void insertUser(User user){
		DB db = MongoConnection.getDB();
		DBCollection collection = db.getCollection(User.class.getName());
		DBObject dbObj = PojoUtil.Pojo2DBObject(user);
		System.out.println(dbObj.toString());
		collection.insert(dbObj);
	}
}
